package com.mconnect.msurvey.model;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

@Entity
@Table(name = "technical_questions")
public class TechnicalQuestions implements Serializable{
	private static final long serialVersionUID = -6060787775770497308L;
	private int id_technical;
	private String direction = "none";
	private String developingPrograms = "none";
	private String experience = "none";
	private DevelopingLanguages id_language;
	private Survey id_survey;
	
	@Id
	@GeneratedValue
	public int getId_technical() {
		return id_technical;
	}
	public void setId_technical(int id_technical) {
		this.id_technical = id_technical;
	}
	
	@ManyToOne
    @JoinColumn(name="id_survey", referencedColumnName="id_survey")
	public Survey getId_survey() {
		return id_survey;
	}
	public void setId_survey(Survey id_survey) {
		this.id_survey = id_survey;
	}
	
	@OneToOne(targetEntity=DevelopingLanguages.class, cascade = CascadeType.ALL, fetch=FetchType.LAZY)
    @JoinColumn(name = "id_language", referencedColumnName="id_language" )
	@Fetch(FetchMode.SELECT)
	public DevelopingLanguages getId_language() {
		return id_language;
	}
	public void setId_language(DevelopingLanguages id_language) {
		this.id_language = id_language;
	}
	@Column(length=30)
	public String getDirection() {
		return direction;
	}
	public void setDirection(String direction) {
		if(!direction.isEmpty())
			this.direction = direction;
	}
	@Column(length=200)
	public String getDevelopingPrograms() {
		return developingPrograms;
	}
	public void setDevelopingPrograms(String developingPrograms) {
		if(!developingPrograms.isEmpty())
			this.developingPrograms = developingPrograms;
	}
	@Column(length=30)
	public String getExperience() {
		return experience;
	}
	public void setExperience(String experience) {
		if(!experience.isEmpty())
			this.experience = experience;
	}
	public TechnicalQuestions(String direction, String experience) {
		super();
		this.direction = direction;
		this.experience = experience;
	}

	public TechnicalQuestions(){}
	

}
